/*
 * ListenerJTable.java
 * Copyright (c) 2006, FMap
 *
 * Created on 27 de octubre de 2005, 1:04
 */

package fmap.gui.actionListener;

import fmap.DatosCompartidos;
import javax.swing.event.*;
import java.awt.event.MouseAdapter;
import javax.swing.table.TableModel;

/**
 *
 * @author  Javier Sanroman Araujo
 * @version $Revision: 1.1
 */
public class ListenerJTablePersonalResultSearch extends MouseAdapter implements ListSelectionListener
{
    /**
     * Creates a new instance of ListenerJTable
     */
    public ListenerJTablePersonalResultSearch ()
    {
    }
    
    
    public void valueChanged (ListSelectionEvent e)
    {
        
        int rowSelect       = DatosCompartidos.getJTablePersonalResultSearch ().getSelectedRow ();
        TableModel tm       = DatosCompartidos.getJTablePersonalResultSearch ().getModel ();
        
        if( rowSelect != -1 )
        {
            Object instanciaDe = (Object)tm.getValueAt (rowSelect, 0);
            fmap.model.Node n = (fmap.model.Node)tm.getValueAt (rowSelect, 0);
            
            DatosCompartidos.setNodeActual ( n );
            
            // Mostramos en el panel derecho el card de los nodos
            java.awt.CardLayout layout = (java.awt.CardLayout)DatosCompartidos.getPanelRight ().getLayout ();
            layout.show (DatosCompartidos.getPanelRight (), "cardNode");
            // --------------------------------------------------------
            
            DatosCompartidos.getPanelRight ().updatePanelRight ( n );
        }
    }
}